
Core.Storage.Rule.register("direct.*");
Core.Storage.Rule.register("direct.long.path.*");

Performance.registerGroup({
	name: "storage.register",
	
	before: function() {
		Core.Storage.Raw.nps = {};
	}
});

Performance.registerTest({
	group: "storage.register",
	name: "register: - short -10x",
	args: [10000, 15000, 25000, 50000],
	
	run: function(arg) {
		var fn = function() {},
			count = arg / 10;
		
		while(arg-- > 0) {
			Core.Storage.Raw.register(["direct", "a" + (arg % count)], fn);
		}
	}
});

Performance.registerTest({
	group: "storage.register",
	name: "register: - short -10x -dynamic-fn",
	args: [10000, 15000, 25000, 50000],
	
	run: function(arg) {
		var i = 0, count = arg / 10;
		while(arg-- > 0) {
			if(i++ > count) { i = 0; }
			Core.Storage.Raw.register(["direct", "a" + i], function(){});
		}
	}
});

Performance.registerTest({
	group: "storage.register",
	name: "register: - long -10x",
	args: [10000, 15000, 25000, 50000],
	
	run: function(arg) {
		var fn = function() {},
			i = 0, count = arg / 10;
		
		while(arg-- > 0) {
			if(i++ > count) { i = 0; }
			Core.Storage.Raw.register(["direct", "long", "path", "a" + i], fn);
		}
	}
});

Performance.registerTest({
	group: "storage.register",
	name: "register: - long -10x -dynamic-fn",
	args: [10000, 15000, 25000, 50000],
	
	run: function(arg) {
		var i = 0, count = arg / 10;
		while(arg-- > 0) {
			if(i++ > count) { i = 0; }
			Core.Storage.Raw.register(["direct", "long", "path", "a" + i], function(){});
		}
	}
});

Performance.registerTest({
	group: "storage.register",
	name: "register: - short -3x",
	args: [10000, 15000, 25000],
	
	run: function(arg) {
		var fn = function() {},
			i = 0, count = arg / 3;
		
		while(arg-- > 0) {
			if(i++ > count) { i = 0; }
			Core.Storage.Raw.register(["direct", "a" + i], fn);
		}
	}
});

Performance.registerTest({
	group: "storage.register",
	name: "register: - long -3x",
	args: [10000, 15000, 25000],
	
	run: function(arg) {
		var fn = function() {},
			i = 0, count = arg / 3;
		
		while(arg-- > 0) {
			if(i++ > count) { i = 0; }
			Core.Storage.Raw.register(["direct", "long", "path", "a" + i], fn);
		}
	}
});

Performance.registerTest({
	group: "storage.register",
	name: "unregister: -with-register -10x",
	args: [5000, 10000, 15000],

	run: function(arg) {
		var fn = function() {},
			i = 0, count = arg / 10;
		
		while(arg-- > 0) {
			if(i++ > count) { i = 0; }
			Core.Storage.Raw.register(["direct", "long", "path", "a" + i], fn);
			Core.Storage.Raw.unregister(["direct", "long", "path", "a" + i], fn);
		}
	}
});

Performance.registerTest({
	group: "storage.register",
	name: "unregister: -with-register -3x",
	args: [5000, 10000, 15000],

	run: function(arg) {
		var fn = function() {},
			i = 0, count = arg / 3;
		
		while(arg-- > 0) {
			if(i++ > count) { i = 0; }
			Core.Storage.Raw.register(["direct", "long", "path", "a" + i], fn);
			Core.Storage.Raw.unregister(["direct", "long", "path", "a" + i], fn);
		}
	}
});